﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.Caching;

namespace GDBLL.Handler
{
    /// <summary>
    /// 处理对脚本文件的请求
    /// </summary>
    internal class EmbeddedJavaScriptHandler : IHttpHandler
    {
        private string fileName;

        /// <summary>
        /// Initializes a new instance of the <see cref="EmbeddedJavaScriptHandler"/> class.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        internal EmbeddedJavaScriptHandler(string fileName)
        {
            this.fileName = fileName;
        }

        #region IHttpHandler Members

        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler"></see> interface.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpContext"></see> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param>
        public void ProcessRequest(HttpContext context)
        {
            context.Response.Write("var a={\"t\":\"It is from EmbeddedJavaScriptHandler\"};");
        }

        /// <summary>
        /// Gets a value indicating whether another request can use the <see cref="T:System.Web.IHttpHandler"></see> instance.
        /// </summary>
        /// <value></value>
        /// <returns>true if the <see cref="T:System.Web.IHttpHandler"></see> instance is reusable; otherwise, false.</returns>
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }

        #endregion
    }
}
